import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:luckin_demo/routes/app_routes.dart';
import 'package:luckin_demo/utils/custom_appbar.dart';

import '../../components/a_button/index.dart';
import '../../utils/global.dart';
import '../toolbar/menu/widgets/radius_btn.dart';

class OrderRemark extends StatefulWidget {
  const OrderRemark({super.key});

  @override
  State<OrderRemark> createState() => _OrderRemarkState();
}

class _OrderRemarkState extends State<OrderRemark> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: customAppbar(title: '订单备注',context: context),
      body: SingleChildScrollView(
        child: Container(
          child: Container(
            color: Colors.white,
            child: Column(
              children: [
                Container(
                  padding: EdgeInsets.symmetric(horizontal: 15),
                  child: const Column(
                    children: [
                      RemarkRow(name: '纸巾'),
                      RemarkRow(name: '奶包'),
                      RemarkRow(name: '糖包', borderBottom: false),
                    ],
                  ),
                ),

                //输入框
                Container(
                  margin: EdgeInsets.only(top: 10,bottom: 20),
                  padding: EdgeInsets.symmetric(horizontal: 15),
                  child: const Row(
                    children: [
                      Expanded(child: TextField(
                        maxLines: 5,
                        keyboardType: TextInputType.multiline,
                        decoration: InputDecoration(
                            filled: true,
                            focusColor: Color.fromRGBO(248, 248, 248, 1),
                            counterText: '',
                            border: OutlineInputBorder(
                              borderSide: BorderSide.none,
                              borderRadius: BorderRadius.all(
                                Radius.circular(4.0),
                              ),
                            ),
                            contentPadding: EdgeInsets.all(10),
                            hintText: '请输入评价内容（可不填）',
                            hintStyle: TextStyle(
                                fontSize: 14,
                                color: Color.fromRGBO(166, 166, 166, 1)),
                            fillColor: Color.fromRGBO(248, 248, 248, 1)),
                      ))
                    ],
                  ),
                ),

          Container(
            child: AButton.normal(
              width: 300,
              child: Text('确认'),
              color: Colors.white,
              bgColor: Color.fromRGBO(144, 192, 239, 1),
              onPressed: () => Get.toNamed(AppRoutes.Order_Confirm),
            )),
              ],
            ),
          ),
        ),
      ),
    );
  }

}

class RemarkRow extends StatelessWidget {
  final String name;
  final bool borderBottom;
  const RemarkRow({ super.key, required this.name,  this.borderBottom = true});

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.only(top: 20, bottom: 10),
      decoration: BoxDecoration(border: cuBorderBottom(show: borderBottom)),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          Container(
            margin: EdgeInsets.only(bottom: 10),
            child: Text(
              name,
              style:
              TextStyle(color: Color.fromRGBO(56, 56, 56, 1), fontSize: 14),
            ),
          ),
          Row(
            children: <Widget>[
              RadiusBtn(
                '不需要',
                isActive: true,
              ),
              RadiusBtn('需要'),
            ],
          )
        ],
      ),
    );
  }
}


